import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'

// 导入Element Plus
import ElementPlus from './plugins/element-plus'

// 导入样式
import './assets/styles/main.css'
import './assets/styles/dark-mode.css'

// 导入自定义指令
import directives from './directives/permission'

// 引入 Vue-ECharts
import VChart from 'vue-echarts'

const app = createApp(App)

// 使用Pinia
app.use(createPinia())

// 使用路由
app.use(router)

// 使用Element Plus
app.use(ElementPlus)

// 全局注册 VChart 组件
app.component('VChart', VChart)

// 注册自定义指令
Object.keys(directives).forEach(key => {
  app.directive(key, directives[key])
})

app.mount('#app')
